<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>兼职股东管理-添加股东</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="description" content="添加兼职股东"/>
    <meta name="keywords" content=""/>
    <meta name="author" content="wangl"/>
    <link rel="icon" href="http://ow9lg82yy.bkt.clouddn.com/24f5c360-485d-4a6d-9468-2a61c353cf37.ico">
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/static/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
    <style type="text/css">
        .layui-form-item .layui-inline {
            width: 33.333%;
            float: left;
            margin-right: 0;
        }

        @media (max-width: 1240px) {
            .layui-form-item .layui-inline {
                width: 100%;
                float: none;
            }
        }

        .layui-form-item .role-box {
            position: relative;
        }

        .layui-form-item .role-box .jq-role-inline {
            height: 100%;
            overflow: auto;
        }

        /***
        *  ztree 图标变成黄色
        */
        .ztree .line {
            line-height: 0;
            border-top: none;
            float: none;
        }

        .ztree li span.button.ico_docu {
            background-position: -110px 0;
            margin-right: 2px;
            vertical-align: top;
        }

        .multiSelect {
            line-height: normal;
            height: auto;
            padding: 4px 10px;
            overflow: hidden;
            min-height: 38px;
            margin-top: -38px;
            left: 0;
            z-index: 99;
            position: relative;
            background: none;
        }

        .multiSelect a {
            padding: 2px 5px;
            background: #908e8e;
            border-radius: 2px;
            color: #fff;
            display: block;
            line-height: 20px;
            height: 20px;
            margin: 2px 5px 2px 0;
            float: left;
        }

        .multiSelect a span {
            float: left;
        }

        .multiSelect a i {
            float: left;
            display: block;
            margin: 2px 0 0 2px;
            border-radius: 2px;
            width: 8px;
            height: 8px;
            background: url(/static/images/close.png) no-repeat center;
            background-size: 65%;
            padding: 4px;
        }

        .multiSelect a i:hover {
            background-color: #545556;
        }

        .layui-field-box a {
            padding: 2px 5px;
            background: #908e8e;
            border-radius: 2px;
            color: #fff;
            display: block;
            line-height: 20px;
            height: 20px;
            margin: 2px 5px 22px 0;
            float: left;
        }

        .layui-field-box a span {
            float: left;
        }

        .boxadd {
            float: left;
            display: block;
            margin: 2px 0 0 2px;
            border-radius: 2px;
            width: 8px;
            height: 8px;
            background-size: 65%;
            padding: 4px;
        }
    </style>
</head>
<body class="childrenBody">
<form class="layui-form" action="/back/shareholder/partner/add" method="POST"
 style="width:80%;">
    <input type="hidden" id="id" name="id" />
<div class="layui-form-item">
    <label class="layui-form-label">姓名</label>
    <div class="layui-input-block">
        <input type="text" class="layui-input" id="nickName" name="nickName" placeholder="请输入姓名">
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">手机号</label>
    <div class="layui-input-block">

        <input type="text" class="layui-input" id="tel" name="tel" placeholder="请输入手机号">
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">开户银行</label>
    <div class="layui-input-block">

        <input type="text" class="layui-input" id="openBank" name="openBank" placeholder="请输入开户银行">
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">开户支行</label>
    <div class="layui-input-block">

        <input type="text" class="layui-input" id="openBankBranch" name="openBankBranch" placeholder="请输入开户支行">
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">银行卡号</label>
    <div class="layui-input-block">

        <input type="text" class="layui-input" id="bankCardNum" name="bankCardNum" placeholder="请输入银行卡号">
    </div>
</div>
    <input type="hidden" id="cardTypeId" name="cardTypeId" value="1" />
<div class="layui-form-item">
    <label class="layui-form-label">身份证号</label>
    <div class="layui-input-block">
        <input type="text" class="layui-input" id="idCardNum" name="idCardNum" placeholder="请输入身份证号">
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">登录密码</label>
    <div class="layui-input-block">

        <input type="text" class="layui-input" id="password" name="password" placeholder="请输入登录密码">
    </div>
</div>

<div class="layui-form-item">
    <div class="layui-input-block">
        <button class="layui-btn" lay-submit="" lay-filter="addPartner">立即提交</button>
        <#--<button type="reset" class="layui-btn layui-btn-primary">重置</button>-->
    </div>
</div>
</form>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/layui/layui.js"></script>
<script type="text/javascript" src="/static/js/wangEditor.min.js"></script>
<script type="text/javascript" src="/static/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>
<script>

    layui.use(['form', 'jquery', 'layer', 'upload', 'laydate'], function () {
        var form = layui.form,
                $ = layui.jquery,
                upload = layui.upload,
                E = window.wangEditor,
                laydate = layui.laydate,
                imageIndex,
                layer = layui.layer,
                zTreeObj,
                setting = {
                    callback: {
                        onClick: function (event, treeId, treeNode) {
                            $("#channelNameShow").val(treeNode.name);
                            $("input[name='channelId']").val(treeNode.id);
                        }
                    }
                },
                // zTreeObj = /*$.fn.zTree($("#treeDemo"), setting,)*/1;
        //普通图片上传
        var anPicture = upload.render({
            elem: '#anPicture',
            url: '/file/upload/',
            field: 'test',
            before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    $('#anPicture').attr('src', result); //图片链接（base64）
                });
                imageIndex = layer.load(2, {
                    shade: [0.3, '#333']
                });
            },
            done: function (res) {
                layer.close(imageIndex);
                //如果上传失败
                if (res.success === false) {
                    return layer.msg('上传失败');
                }
                $("#showPic").val(res.data.url);
            },
            error: function () {
                layer.close(imageIndex);
                //演示失败状态，并实现重传
                var demoText = $('#demoText_showPic');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function () {
                    anPicture.upload();
                });
            }
        });

        //初始赋值
        laydate.render({
            elem: '#publistTime',
            value: new Date()
        });
        var content_editor = new E('#content');
        //图片上传
        content_editor.customConfig.uploadImgServer = '/file/uploadWang';
        content_editor.customConfig.uploadFileName = 'test';
        // 自定义处理粘贴的文本内容(这里处理图片抓取)
        content_editor.customConfig.pasteTextHandle = function (content) {
            if (undefined === content) {
                return content;
            }
            if (content.indexOf("src=") <= 0) {
                return content;
            }
            var loadContent = layer.load(2, {
                shade: [0.3, '#333']
            });
            $.ajax({
                url: "/file/doContent/",
                type: "POST",
                async: false,
                data: {"content": content},
                dataType: "json",
                success: function (res) {
                    layer.close(loadContent);
                    content = res.data;
                }
            });
            return content;
        };
        // 关闭粘贴样式的过滤
        content_editor.customConfig.pasteFilterStyle = false;
        content_editor.customConfig.customAlert = function (info) {
            // info 是需要提示的内容
            console.log("info:" + info);
            layer.msg(info);
        };
        var anContentInput = $("#anContent");
        content_editor.customConfig.onchange = function (html) {
            // html 即编辑器中的内容
            console.log("123"+html);
            anContentInput.val(html);
        };
        content_editor.create();

        var id = getParam("id");

        function getPartner(id) {
            var partner;
            $.ajax({
                async: false,
                url: '/back/shareholder/partner/edit?userId=' + id + '',
                type: 'get',
                success: function (baseDto) {
                    dealBaseDto(baseDto, function (baseDto) {
                        partner = baseDto.data;
                    })

                }
            });
            return partner;
        }

        var partner = getPartner(id);
        function loadData(partner) {
            // //设置创建时间
            // var newCreateTimeInput = $("#createTime");
            // newCreateTimeInput.val(news.createTime);
            // //设置更新时间
            // var newUpdateTimeInput = $("#updateTime");
            // newUpdateTimeInput.val(news.updateTime);
            //设置id
            var partnerIdInput = $("#id");
            partnerIdInput.val(partner.id);
            //设置姓名
            var partnerNickNameInput = $("#nickName");
            partnerNickNameInput.val(partner.nickName);
            //设置手机号
            var partnerTelInput = $("#tel");
            partnerTelInput.val(partner.tel);
        }

        loadData(partner);

        layui.use('form', function () {
            var form = layui.form;
            //监听提交
            form.on('submit(*)', function (data) {
                window.location.href = '/back/shareholder/listpage';
            });
        });

    });

    // function addPartner() {
    //     $.ajax({
    //         url: "/back/shareholder/partner/add",
    //         type: "GET",
    //         // String idCardNum,String nickName,Integer cardTypeId,
    //         // String tel, String openBank,String openBankBranch,
    //         // String bankCardNum,String password
    //         data: {
    //             "nickName": nickName,
    //             "tel": tel,
    //             "openBank": openBank,
    //             "openBankBranch": openBankBranch,
    //             "bankCardNum": bankCardNum,
    //             "password": password
    //         },
    //     });
    //     window.location.href = '/back/shareholder/listpage';
    //     return baseDto;
    // }
</script>
</body>
</html>